  $(function() {
  	function log( message ) {
			$( "<div/>" ).text( message ).prependTo( "#log" );
			$( "#log" ).scrollTop( 0 );
		}
    $("#searchfield").autocomplete({
      source: "{{url_for('quick_search')}}",
      minLength: 2,
      select: function( event, ui ) {
      log( ui.item ?
        "Selected: " + ui.item.value + " aka " + ui.item.id :
        "Nothing selected, input was " + this.value );
      }
    }); 